﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace KerriganBlog
{
    public partial class AutoPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {


                using (ServiceProxy Srv = new ServiceProxy())
                {

                    GridView1.DataSource = Srv.Service.GetArticleCarToDisplay();
                    GridView1.DataBind();
                }


            }
        }

        protected void GridView1_Paging(object sender, GridViewPageEventArgs e)
        {

            GridView1.PageIndex = e.NewPageIndex;
            RefreshDataGrid();
        }


        protected void RefreshDataGrid()
        {
            this.GridView1.DataSource = null;
            using (ServiceProxy Srv = new ServiceProxy())
            {

                GridView1.DataSource = Srv.Service.GetArticleCarToDisplay();
                GridView1.DataBind();

            }

        }

    }
}